home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BCI NET
/
BCI NET Dec 94.iso
/
archives
/
programming
/
libraries
/
mui20dev.lha
/
MUI
/
Developer
/
Autodocs
/
MUImaster.doc
< prev
Wrap
Text File
|
1994-02-11
|
18KB
|
590 lines
TABLE OF CONTENTS
muimaster.library/--background--
muimaster.library/MUI_AllocAslRequest
muimaster.library/MUI_AslRequest
muimaster.library/MUI_DisposeObject
muimaster.library/MUI_Error
muimaster.library/MUI_FreeAslRequest
muimaster.library/MUI_FreeClass
muimaster.library/MUI_GetClass
muimaster.library/MUI_NewObjectA
muimaster.library/MUI_Redraw
muimaster.library/MUI_RequestA
muimaster.library/MUI_RejectIDCMP
muimaster.library/MUI_RequestIDCMP
muimaster.library/MUI_SetError
muimaster.library/--background-- muimaster.library/--background--
PURPOSE
muimaster.library contains functions for creating and diposing
objects, for requester handling and for controlling custom
classes. Additionally, several of the standard MUI classes are
built into muimaster.library. For you as a programmer, there
is no difference between using a builtin class or an external
class coming as "sys:classes/<foobar>.mui". The MUI object
generation call takes care of this situation and loads
external classes automatically when they are needed.
muimaster.library/MUI_AllocAslRequest muimaster.library/MUI_AllocAslRequest
NAME
MUI_AllocAslRequest
FUNCTION
Provide an interface to asl.library. Using this ensures
your application will benefit from future expansions
to MUI's window and iconification handling.
SEE ALSO
asl.library/AllocAslRequest
muimaster.library/MUI_AslRequest
NAME
MUI_AslRequest
FUNCTION
Provide an interface to asl.library. Using this ensures
your application will benefit from future expansions
to MUI's window and iconification handling.
SEE ALSO
asl.library/AslRequest
muimaster.library/MUI_DisposeObject muimaster.library/MUI_DisposeObject
NAME
MUI_DisposeObject -- Delete a MUI object.
SYNOPSIS
MUI_DisposeObject( object )
A0
VOID MUI_DisposeObject( APTR );
FUNCTION
Deletes a MUI object and all of it's auxiliary data.
These objects are all created by MUI_NewObject(). Objects
of certain classes "own" other objects, which will also
be deleted when the object is passed to MUI_DisposeObject().
Read the per-class documentation carefully to be aware
of these instances.
INPUTS
object = abstract pointer to a MUI object returned by
MUI_NewObject(). The pointer may be NULL, in which case
this function has no effect.
RESULT
None.
BUGS
SEE ALSO
MUI_NewObject(), SetAttrs(), GetAttr().
muimaster.library/MUI_Error muimaster.library/MUI_Error
NAME
MUI_Error -- Return extra information from the MUI system.
SYNOPSIS
LONG MUI_Error(VOID);
FUNCTION
Some MUI functions will set an error if they fail for
some reason. The error functions is task sensitive,
only the task that caused the error will receive it
from this function.
RESULT
Currently, the following error values are defined:
MUIE_OK - no error, everything allright.
MUIE_OutOfMemory - went out of memory.
MUIE_OutOfGfxMemory - went out of graphics memory.
MUIE_InvalidWindowObject - NULL window specified.
MUIE_MissingLibrary - can't open a needed library.
MUIE_NoARexx - unable to create arexx port.
MUIE_SingleTask - application is already running.
SEE ALSO
MUI_SetError()
muimaster.library/MUI_FreeAslRequest muimaster.library/MUI_FreeAslRequest
NAME
MUI_FreeAslRequest
FUNCTION
Provide an interface to asl.library. Using this ensures
your application will benefit from future expansions
to MUI's window and iconification handling.
SEE ALSO
asl.library/FreeAslRequest
muimaster.library/MUI_FreeClass muimaster.library/MUI_FreeClass
NAME
MUI_FreeClass -- Free class.
SYNOPSIS
MUI_FreeClass( classptr )
A0
VOID MUI_FreeClass(struct IClass *classptr);
FUNCTION
Free a class pointer obtained with MUI_GetClass(). You may not
free a class as long as its superclass of some of your custom
classes. You may not terminate your program without explicitly
freeing everything obtained with MUI_FreeClass().
INPUTS
classptr - pointer obtained with MUI_GetClass().
SEE ALSO
MUI_GetClass()
muimaster.library/MUI_GetClass muimaster.library/MUI_GetClass
NAME
MUI_GetClass -- Get a pointer to a MUI class.
SYNOPSIS
class = MUI_GetClass( classid )
D0 A0
struct IClass * MUI_GetClass(char *classid);
FUNCTION
Get a pointer to a MUI class and prevent the clas from
being expunged.
When you create a custom class with intuition.library/MakeClass(),
you need to specify the direct superclass of your class. Since
MUI classes are no public boopsi classes, you will need a pointer
to the IClass structure here. MUI_GetClass() takes a MUI class
id (e.g. MUIC_Area, MUIC_Text, ...) and returns the associated
class pointer. When the class is external, its loaded.
MUI_GetClass() also prevents the specified class from being
expunged. Once you're done with your custom class, you must
call MUI_FreeClass() to remove the lock.
INPUTS
classid - a string describing the MUI class, e.g.
MUIC_Area, MUIC_Group, ...
RESULT
class - Pointer to the IClass structure of the specified class.
You are neither allowed to alter any of its fields nor
to make any assumptions about its contents. The only
valid use for this pointer is as parameter for
intuition.library/MakeClass().
class will be NULL in case of failure.
EXAMPLE
/* Get a pointer to the superclass. MUI will lock this */
/* and prevent it from being flushed during you hold */
/* the pointer. When you're done, you have to call */
/* MUI_FreeClass() to release this lock. */
if (!(SuperClass=MUI_GetClass(MUIC_Area)))
fail("Superclass for the new class not found.");
/* Create the new class with the boopsi function call. */
/* You will need the sizeof your classes instance data */
/* here. */
if (!(MyClass=MakeClass(NULL,NULL,SuperClass,sizeof(struct Data),0)))
@{
MUI_FreeClass(SuperClass);
fail("Failed to create class.");
@}
/* Set the dispatcher for the new class. */
MyClass->cl_Dispatcher.h_Entry = (APTR)MyDispatcher;
MyClass->cl_Dispatcher.h_SubEntry = NULL;
MyClass->cl_Dispatcher.h_Data = NULL;
...
...
app = ApplicationObject,
...,
SubWindow, window = WindowObject,
...
WindowContents, VGroup,
Child, MyObj = NewObject(MyClass,NULL,
TextFrame,
MUIA_Background, MUII_BACKGROUND,
TAG_DONE),
End,
End,
End;
...
...
/* Shutdown. When the application is disposed,
/* MUI also deletes MyObj. */
MUI_DisposeObject(app); // dispose all objects.
FreeClass(MyClass); // free our private class.
MUI_FreeClass(SuperClass); // release super class pointer.
SEE ALSO
MUI_FreeClass(), intuition.library/MakeClass()
muimaster.library/MUI_NewObjectA muimaster.library/MUI_NewObjectA
NAME
MUI_NewObjectA -- Create an object from a class.
MUI_NewObject -- Varargs stub for MUI_NewObjectA().
SYNOPSIS
object = MUI_NewObjectA( class, tags )
D0 A0 A1
APTR MUI_NewObjectA( char *, struct TagItem * );
object = MUI_NewObject( classID, Tag1, ... )
APTR MUI_NewObject( classID, ULONG, ... );
FUNCTION
This is the general method of creating objects from MUI classes.
You specify a class by its ID string. If the class is not
already in memory or built into muimaster.library, it will be
loaded using OpenLibrary("mui/%s",0).
You further specify initial "create-time" attributes for the
object via a TagItem list, and they are applied to the resulting
generic data object that is returned. The attributes, their meanings,
attributes applied only at create-time, and required attributes
are all defined and documented on a class-by-class basis.
INPUTS
classID = the name/ID string of a MUI class, e.g. "Image.mui".
Class names are case sensitive!
tagList = pointer to array of TagItems containing attribute/value
pairs to be applied to the object being created.
RESULT
A MUI object, which may be used in different contexts such
as an application, window or gadget, and may be manipulated
by generic functions. You eventually free the object using
MUI_DisposeObject().
NULL indicates failure, more information on the error can be
obtained with MUI_Error().
BUGS
SEE ALSO
MUI_DisposeObject(), MUI_Error(), SetAttrs(), GetAttr().
muimaster.library/MUI_Redraw muimaster.library/MUI_Redraw
NAME
MUI_Redraw -- Redraw yourself.
SYNOPSIS
MUI_Redraw( obj, flag )
A0 D0
VOID MUI_Redraw( Object *obj, ULONG flag );
FUNCTION
With MUI_Redraw(), an object tells itself to refresh, e.g. when
some internal attributes were changed. Calling MUI_Redraw() is
only legal within a custom class dispatcher, using this function
within an applications main part is invalid!
Most objects graphical representation in a window depends on some
attributes. A fuel gauge for example would depend on its
MUIA_Gauge_Current attribute, an animation object would
depend on MUIA_Animation_CurrentFrame.
Whenever someone changes such an attribute with a SetAttrs() call,
the corresponding object receives an OM_SET method with the new
value. Usually, it could just render itself with some
graphics.library calls. However, if the object is placed
in a virtual group or if some other clipping or coordinate
translation is required, this simple rendering will lead
into problems.
That's why MUI offers the MUI_Redraw() function call. Instead
of drawing directly during OM_SET, you should simply call
MUI_Redraw(). MUI calculates all necessary coordinates
and clip regions (in case of virtual groups) and then sends
a MUIM_Draw method to your object.
To emphasize this point again: The only time your object is
allowed to render something is when you receive a MUIM_Draw
method. Drawing during other methods is illegal.
Note: As long as no special cases (e.g. virtual groups) are
present, MUI_Redraw is very quick and calls your MUIM_Draw
method immediately. No coordinate translations or clip
regions need to be calculated.
INPUTS
obj - pointer to yourself.
flag - MADF_DRAWOBJECT or MADF_DRAWUPDATE.
The flag given here affects the objects flags when
MUI calls the MUIM_Draw method. There are several
caveats when implementing MUIM_DRAW, see the
developer documentation for details.
EXAMPLE
LONG mSet(struct IClass *cl,Object *obj,sruct opSet *msg)
{
struct Data *data = INST_DATA(cl,obj);
struct TagItem *tags,*tag;
for (tags=msg->ops_AttrList;tag=NextTagItem(&tags);)
{
switch (tag->ti_Tag)
{
case MYATTR_PEN_1:
data->pen1 = tag->ti_Data; /* set the new value */
data->mark = 1; /* set internal marker*/
MUI_Redraw(obj,MADF_DRAWUPDATE); /* update ourselves */
break;
case MYATTR_PEN_1:
data->pen2 = tag->ti_Data; /* set the new value */
data->mark = 2; /* set internal marker*/
MUI_Redraw(obj,MADF_DRAWUPDATE); /* update ourselves */
break;
}
}
return(DoSuperMethodA(cl,obj,msg));
}
LONG mDraw(struct IClass *cl,Object *obj,struct MUIP_Draw *msg)
{
struct Data *data = INST_DATA(cl,obj);
if (msg->flags & MADF_DRAWUPDATE)
{
/* called as a result of our MUI_Redraw() during
MUIM_Set method. Depending on our internal
marker, we render different things. */
switch (data->mark)
{
case 1: RenderChangesFromPen1(cl,obj); break;
case 2: RenderChangesFromPen2(cl,obj); break;
}
/* do not call the superclass for speed reasons here.
it wouldn't do anything anyway since MADF_DRAWUPDATE
is reserved for custom class use. */
return;
}
DoSuperMethodA(cl,obj,msg); // let superclass draw frames/etc.
if (msg->flags & MADF_DRAWOBJECT)
{
/* complete redraw, maybe the window was just opened. */
DrawObjectCompletely(cl,obj);
}
/* if MADF_DRAWOBJECT wasn't set, MUI just wanted to update
the frame or some other part of our object. In this case
we just do nothing. */
return(0);
}
SEE ALSO
area.mui/MUIM_Draw
muimaster.library/MUI_RequestA muimaster.library/MUI_RequestA
NAME
MUI_RequestA -- Pop up a MUI requester.
SYNOPSIS
MUI_RequestA(app,win,flags,title,gadgets,format,params)
D0 D1 D2 A0 A1 A2 A3
LONG MUI_RequestA ( APTR app, APTR win, LONGBITS flags,
char *title, char *gadgets, char *format, APTR params );
LONG MUI_Request ( APTR app, APTR win, LONGBITS flags,
char *title, char *gadgets, char *format, ...);
FUNCTION
Pop up a MUI requester. Using a MUI requester instead
of a standard system requester offers you the possibility
to include text containing all the text engine format codes.
INPUTS
app - The application object. If you leave this
NULL, MUI_RequestA() will fall back to a
standard system requester.
win - Pointer to a window of the application. If
this is used, the requester will appear centered
relative to this window.
flags - For future expansion, must be 0 for now.
title - Title for the requester window. Defaults to the
name of the application when NULL (and app!=NULL).
gadgets - Pointer to a string containing the possible answers.
The format looks like "_Save|_Use|_Test|_Cancel".
If you precede an entry with a '*', this answer will
become the active object. Pressing <Return> will
terminate the requester with this response. A '_'
character indicates the keyboard shortcut for this
response.
format - A printf-style formatting string.
params - Pointer to an array of ULONG containing the parameter
values for format.
RESULT
0, 1, ..., N = Successive id values, for the gadgets
you specify for the requester. NOTE: The numbering
from left to right is actually: 1, 2, ..., N, 0.
SEE ALSO
MUIA_Text_Contents
muimaster.library/MUI_RejectIDCMP muimaster.library/MUI_RejectIDCMP
NAME
MUI_RejectIDCMP -- Reject previously requested input events.
SYNOPSIS
MUI_RejectIDCMP( obj, flags )
A0 D0
VOID MUI_RejectIDCMP( Object *obj, ULONG flags );
FUNCTION
Reject previously requested input events. You should
ensure that you reject all input events you requested
for an object before it gets disposed. Rejecting
flags that you never requested has no effect.
Critical flags such as IDCMP_MOUSEMOVE and IDCMP_INTUITICKS
should be rejected as soon as possible. See MUI_RequestIDCMP()
for details.
INPUTS
obj - pointer to yourself as an object.
flags - one or more IDCMP_XXXX flags.
EXAMPLE
LONG CleanupMethod(struct IClass *cl, Object *obj, Msg msg)
{
MUI_RejectIDCMP( obj, IDCMP_MOUSEBUTTONS|IDCMP_RAWKEY );
return(DoSuperMethodA(cl,obj,msg));
}
SEE ALSO
MUI_RequestIDMCP()
muimaster.library/MUI_RequestIDCMP muimaster.library/MUI_RequestIDCMP
NAME
MUI_RequestIDCMP -- Request input events for your custom class.
SYNOPSIS
MUI_RequestIDCMP( obj, flags )
A0 D0
VOID MUI_RequestIDCMP( Object *obj, ULONG flags );
FUNCTION
If your custom class needs to do some input handling, you must
explicitly request the events you want to receive. You can
request (and reject) events at any time.
Whenever an input event you requested arrives at your parent
windows message port, your object will receive a
MUIM_HandleInput method.
Note: Time consuming IDCMP flags such as IDCMP_INTUITICKS and
IDCMP_MOUSEMOVE should be handled with care. Too many
objects receiving them will degrade performance With
the following paragraph in mind, this isn't really
a problem:
You should try to request critical events only when you
really need them and reject them with MUI_RejectIDCMP()
as soon as possible. Usually, mouse controlled objects
only need MOUSEMOVES and INTUITICKS when a button
is pressed. You should request these flags only
on demand, i.e. after receiving a mouse down event
and reject them immediately after the button has been
released.
INPUTS
obj - pointer to yourself as an object.
flags - one or more IDCMP_XXXX flags.
EXAMPLE
LONG SetupMethod(struct IClass *cl, Object *obj, Msg msg)
{
if (!DoSuperMethodA(cl,obj,msg))
return(FALSE);
/* do some setup here... */
...;
/* i need mousebutton events and keyboard */
MUI_RequestIDCMP( obj, IDCMP_MOUSEBUTTONS|IDCMP_RAWKEY );
return(TRUE);
}
SEE ALSO
MUI_RejectIDMCP()
muimaster.library/MUI_SetError muimaster.library/MUI_SetError
NAME
MUI_SetError -- Set an error value.
SYNOPSIS
VOID MUI_SetError(LONG);
FUNCTION
Setup a MUI error. MUI_Error() will return this value when
asked.
SEE ALSO
MUI_Error()